In this project, we will use the R programming language to analyze Dallas crime data(2016). The goal is to explore and understand data by cleaning it, converting it to a useful format, and analyzing it to better understand what’s going on. We will then use visualizations to help us see patterns, identify outliers, and understand how the data is distributed. Using exploratory data analysis techniques, we can gain insights from the data and present our findings in easy-to-understand reports. This project is a great way to learn about data analysis and visualization using real crime data from Dallas.
When I started analyzing the crime data in Dallas, I discovered that the data was not in the right format. I went through several steps to clear the data. First, I changed the date column to be in the format YYYY-MM-DD. Then I ignore the first row of data because it only contains column definitions. I then replace any empty or blank entries with NA . I then trimmed all leading and trailing spaces in all columns to ensure data consistency. Finally, I converted the data types of some columns to the required data types. All these steps help me clean the data and prepare it for further analysis and visualization.
After performing EDA to prepare the dataset for analysis, various methods and visualization techniques were applied to extract insights from the data. The Results section presents these methods along with their interpretations, revealing additional information about the dataset
In Dallos, Texas, the crime rate has been a major concern for years. In order to address this issue, the local police department has been collecting data on crime incidents in the area. Using this data, we can explore various aspects of crime in the city.
Firstly, I analyzed the total count of crime incidents categorized by year, month, and hour. Looking at the breakdown of crime incidents by hour, we can see that the morning hours have relatively low crime rates. However, the crime rate increases during the rest of the day, peaking in the late evening and early morning hours. This suggests that additional measures, such as increasing police presence, installing CCTV cameras, and implementing community policing initiatives may be necessary during these high crime rate periods.
Analyzing the data by month, we can see that the highest number of crimes occur in January, February, and March. This could be due to a number of factors, such as the cold weather, increased consumption of alcohol and drugs, and more indoor activities during the winter months. As the weather warms up and people spend more time outdoors, crime rates tend to decrease. rewrite it in simple language.This data allows us to identify the times of day and months when crime incidents are most likely to occur.
The two-way table of subject’s gender and race count shows us the number of individuals involved in crime based on their gender and race. From the table, we can see that Black males have the highest number of crime incidents, followed by Hispanic males and White males. This information can be used to develop targeted interventions aimed at addressing the root causes of crime within these communities.
Additionally, the table shows that there are very few incidents involving American Indian, Asian, and Other race subjects. This information could be useful in focusing resources on communities with higher crime rates, while also identifying areas where crime rates are lower and may not require as much attention.
Furthermore, we can see that the number of incidents involving female subjects is significantly lower than that of males. However, it’s still important to investigate the reasons behind these incidents and develop interventions aimed at reducing them.Finally, there are some incidents where the subject’s race is unknown or not applicable (NULL).
| American Ind | Asian | Black | Hispanic | Other | White | |
|---|---|---|---|---|---|---|
| Female | 0 | 0 | 274 | 69 | 0 | 93 |
| Male | 1 | 5 | 1058 | 455 | 11 | 377 |
| Unknown | 0 | 0 | 1 | 0 | 0 | 0 |
By comparing crime rates between different races of subjects, we can see that certain communities experience a higher number of crime incidents than others. In this case, the data suggests that Black subjects are more likely to be involved in crimes compared to White subjects, as seen in the per month graphs. This information can be used to allocate resources and focus efforts on reducing crime rates in areas where Black subjects are more likely to be involved in criminal activities. By understanding the root causes of crime in these communities, interventions can be developed to address these issues and create a safer environment for all individuals.
The list of the top 10 subject descriptions shows us the most common factors that contribute to crime incidents. The data indicates that individuals with mental health issues and those under the influence of alcohol or drugs are frequently involved in criminal activities. Additionally, there are many incidents where the subject is unknown or the type of drug is unknown.
This information can be used to develop targeted interventions aimed at reducing crime incidents involving mentally unstable individuals or those under the influence of drugs or alcohol.Furthermore, the list highlights the importance of improving drug education and prevention efforts to reduce drug-related crimes. It also shows that incidents involving firearms are relatively low compared to incidents involving alcohol or drugs.
Analyzing officer’s data is important to understand structure of police force and officer’s tenure.It can help us identify any unfair treatment or excessive use of force, which can affect the relationship between the police and the community. By studying officer’s data, we can find ways to improve police practices and policies, which can lead to better outcomes for both the police and the public they serve.
The two pie chart shows the count, proportion, and percentage of officers in different races and genders.we can see that most of the officers are male, accounting for 90% of the total officers. In terms of race, the majority of officers are White, making up 62% of the total officers, followed by Hispanic and Black officers, who make up 20% and 14% respectively. There are also some officers from Asian, American Indian, and Other races, each representing a smaller proportion of the total officers. Additionally, the table shows that there are more male officers than female officers, with males being the majority gender in law enforcement.
This graph shows the distribution of the force on duty for male and female officers. The x-axis shows the force on duty, which is a measure of the physical effort that officers exert during their duty. The y-axis shows the density, which is a measure of how many officers fall into a particular force on duty range.
The graph shows that male officers tend to have a higher force on duty compared to female officers. The density curve for male officers is shifted towards the right, indicating that more male officers have higher force on duty compared to female officers. The density curve for female officers is shifted towards the left, indicating that more female officers have lower force on duty compared to male officers.
It’s important to examine the officer’s race-wise injury status to understand the risks that law enforcement officers face while they are working. This analysis can help us identify if certain racial groups of officers face higher risks of injury while performing their duties.Below graph appears that Asian officers have a higher rate of injuries than Black, Hispanic, and White officers.
After analyzing officer injury data, we can explore the count of reasons for which officers get hospitalized. The data shows the number of hospitalizations for different types of injuries, such as abrasions, bites, bruises, dizziness, and fatigue.From graph it appears that most of the reported officer injuries were relatively minor, such as abrasions, bites, bruises, and fatigue, which did not require hospitalization. However, there were a few cases where hospitalization was necessary, such as for elevated heart rate, dizziness, and exposure to body fluids.
The analysis shows that in cases involving a black subject, there is a higher likelihood that a white officer will be involved. This finding can potentially raise concerns about racial biases and disproportionate treatment by law enforcement.
By analyzing the interactive graph for subject gender, race, arrested or not per division, we can observe that White, Hispanic, and Black subjects are spread across all the divisions in Dallas and attempted various types of crimes. However, the majority of them were arrested. We also noticed that there were more male subjects involved in crimes compared to female subjects in each division. This analysis can provide useful insights for law enforcement agencies to identify the areas with higher crime rates and take appropriate measures to reduce crime and ensure public safety.
A map representation of criminal count in Dallos, Texas, shows the distribution of crime incidents across the city. This information can help to identify high-crime areas and allocate resources accordingly.
A division-wise spread of crime rate with scattered plot provides a more nuanced understanding of crime patterns across different divisions of the city. The density of crime rate is more dense in the central division and it beacome less dense in other division.Crime rates tend to be higher in areas where there are more people.However, other factors such as the presence of businesses, quality of policing, and access to resources may also be influencing crime rates in different divisions.
This analysis shows that crime rate in Dallas (2016) is higher at night and during the colder months like Jan,Feb,March. The majority of people involved in crime are black (both male and female), a worrying trend from a racial inequality perspective. In addition, the most common descriptions of the subjects were that they had psychological problems or were under the influence of alcohol.
On the other hand, the majority of police officers are male and white, which also points to gender and racial inequality in policing. Interestingly, Asian officers were more likely to be injured on the job than officers of other races.
Additionally, the study found that white officers handle the majority of cases involving blacks, pointing to the underlying problem of racial profiling. Moreover, civil servants with more experience tend to be men, which can lead to gender inequality in the promotion of women civil servants.
Finally, the study found that crime rates in the Midlands are higher than in other regions. Law enforcement agencies can use this information to more effectively allocate resources to fight crime and improve public safety.
Overall, the study highlights the need to address racial and gender disparities in policing and improve training to reduce racial profiling. The results also show that additional resources are needed to fight crime in areas with higher crime rates